#ifndef _MAIN_C_
#define _MAIN_C_

/*********************************************************************************************************************/
#include "main.h"


#define PERIOD_COUNT (uint16_t)1200
uint16_t t_Count = 0;
uint16_t t_TimeMs = 0;    

void main(void)
{
    
#ifdef UART0_EN
	Uart0_Initial(UART0_BAUTRATE);
#endif

	Timer1Init();

    GPIO_Init(P35F,OUTPUT);
    
	EA = 1;

#ifdef PRINT_EN
	uart_printf("main example!\n");
#endif
	
    //ResetMsClockTick(&t_Count);
    P35 = 1;

	while(1)
	{
#if 0        
        if(GetMsClockTick(&t_Count) >= (PERIOD_COUNT/2))
        {
            ResetMsClockTick(&t_Count);
            P35 = ~P35;
            //P35 ^= 1;
        }
#else
        if(t_TimeMs != GetProClockTick())
        {
            t_TimeMs = GetProClockTick();
            t_Count++;
            if(t_Count >= (PERIOD_COUNT/2))
            {
                t_Count = 0;
                 P35 = ~P35;
            }
        }
#endif
   }
}
#endif
